{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "de24d10f",
   "metadata": {},
   "source": [
    "# Week 04"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "be9374da",
   "metadata": {},
   "source": [
    "## 一、列表练习\n",
    "\n",
    "### 1.尝试用户输入学生一周的课表信息，尝试用占位符、2种format打印课程表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4bb9fb40",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请依次输入您每天的课程\n",
      "星期一：羽毛球@东区体育馆；创业基础实践@1-401\n",
      "星期二：英语@10-204；网站运营与管理@3实304\n",
      "星期三：毛概实践@7-402；毛概理论@7-402\n",
      "星期四：Python@新综612；科学技术发展史；英语@10-205\n",
      "星期五：Illustrator软件应用\n",
      "课程表\n",
      "星期一 羽毛球@东区体育馆；创业基础实践@1-401\n",
      "星期二 英语@10-204；网站运营与管理@3实304\n",
      "星期三 毛概实践@7-402；毛概理论@7-402\n",
      "星期四 Python@新综612；科学技术发展史；英语@10-205\n",
      "星期五 Illustrator软件应用\n",
      "\n",
      "课程表\n",
      "星期一 羽毛球@东区体育馆；创业基础实践@1-401\n",
      "星期二 英语@10-204；网站运营与管理@3实304\n",
      "星期三 毛概实践@7-402；毛概理论@7-402\n",
      "星期四 Python@新综612；科学技术发展史；英语@10-205\n",
      "星期五 Illustrator软件应用\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(\"请依次输入您每天的课程\")\n",
    "mon = input(\"星期一：\")\n",
    "tue = input(\"星期二：\")\n",
    "wed = input(\"星期三：\")\n",
    "thu = input(\"星期四：\")\n",
    "fri = input(\"星期五：\")\n",
    "\n",
    "# 使用占位符\n",
    "timeTable = '''课程表\n",
    "星期一 %s\n",
    "星期二 %s\n",
    "星期三 %s\n",
    "星期四 %s\n",
    "星期五 %s\n",
    "''' % (mon, tue, wed, thu, fri)\n",
    "#print(timeTable)\n",
    "\n",
    "# 使用Format\n",
    "timeTableWithFormat1 = '''课程表\n",
    "星期一 {}\n",
    "星期二 {}\n",
    "星期三 {}\n",
    "星期四 {}\n",
    "星期五 {}\n",
    "''' .format(mon, tue, wed, thu, fri)\n",
    "print(timeTableWithFormat1)\n",
    "\n",
    "timeTableWithFormat2 = '''课程表\n",
    "星期一 {mon}\n",
    "星期二 {tue}\n",
    "星期三 {wed}\n",
    "星期四 {thu}\n",
    "星期五 {fri}\n",
    "''' .format(mon=mon, tue=tue, wed=wed, thu=thu, fri=fri)\n",
    "print(timeTableWithFormat2)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "16f5ba69",
   "metadata": {},
   "source": [
    "### 2.运用if、elif、eles、input、int制作用户输入查询日期和时间，可反应的课表信息；用户输入当前时间，可查询当前课表信息。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "dc88194c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "星期：二\n",
      "小时：10\n",
      "分钟：40\n",
      "现在是星期二的10:40\n",
      "大学英语@10-204\n"
     ]
    }
   ],
   "source": [
    "# 用户输入查询日期和时间，可反应的课表信息\n",
    "\n",
    "day = input(\"星期：\")\n",
    "hour = input(\"小时：\")\n",
    "minute = input(\"分钟：\")\n",
    "now = int(hour + minute)\n",
    "\n",
    "print(\"现在是星期{}的{}:{}\".format(day, hour, minute))\n",
    "\n",
    "if day == \"一\":\n",
    "    if 1035 < now < 1200:\n",
    "        print(\"羽毛球@东区体育馆\")\n",
    "    elif 1430< now <1650:\n",
    "        print(\"创业基础实践@1-401\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "elif day == \"二\":\n",
    "    if 1035 < now < 1200:\n",
    "        print(\"大学英语@10-204\")\n",
    "    elif 1430 < now < 1650:\n",
    "        print(\"网站运营与管理@3实304\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "elif day == \"三\":\n",
    "    if 1035 < now < 1200:\n",
    "        print(\"毛概实践@7-402\")\n",
    "    elif 1845 < now < 2055:\n",
    "        print(\"毛概理论@7-402\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "elif day == \"四\":\n",
    "    if 945 < now < 1200:\n",
    "        print(\"Python语言@新综612\")\n",
    "    elif 1430 < now < 1555:\n",
    "        print(\"科学技术发展史@11-401\")\n",
    "    elif 1610 < now < 1735:\n",
    "        print(\"大学英语@10-205\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "elif day == \"五\":\n",
    "    if 1035 < now < 1200:\n",
    "        print(\"Illustrator软件应用@新综612\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "else:\n",
    "    print(\"你已经放假啦！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "5c94353a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "现在时间15:45\n",
      "你现在没有课哦。\n"
     ]
    }
   ],
   "source": [
    "# 用户输入当前时间，可查询当前课表信息\n",
    "\n",
    "import time\n",
    "\n",
    "today = time.strftime(\"%A\")\n",
    "now = int(time.strftime(\"%H%M\"))\n",
    "\n",
    "print(\"现在时间{}\".format(time.strftime(\"%H:%M\")))\n",
    "if today == \"Monday\":\n",
    "    if 1035 < now < 1200:\n",
    "        print(\"羽毛球@东区体育馆\")\n",
    "    elif 1430< now <1650:\n",
    "        print(\"创业基础实践@1-401\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "elif today == \"Tuesday\":\n",
    "    if 1035 < now < 1200:\n",
    "        print(\"大学英语@10-204\")\n",
    "    elif 1430 < now < 1650:\n",
    "        print(\"网站运营与管理@3实304\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "elif today == \"Wednesday\":\n",
    "    if 1035 < now < 1200:\n",
    "        print(\"毛概实践@7-402\")\n",
    "    elif 1845 < now < 2055:\n",
    "        print(\"毛概理论@7-402\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "elif today == \"Thursday\":\n",
    "    if 945 < now < 1200:\n",
    "        print(\"Python语言@新综612\")\n",
    "    elif 1430 < now < 1555:\n",
    "        print(\"科学技术发展史@11-401\")\n",
    "    elif 1610 < now < 1735:\n",
    "        print(\"大学英语@10-205\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "elif today == \"Friday\":\n",
    "    if 1035 < now < 1200:\n",
    "        print(\"Illustrator软件应用@新综612\")\n",
    "    else:\n",
    "        print(\"你现在没有课哦。\")\n",
    "else:\n",
    "    print(\"你已经放假啦！\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "661.778px",
    "left": "26px",
    "top": "133.556px",
    "width": "341.333px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
